﻿package com.teaphy.coroutinecrawler.job

import kotlinx.coroutines.*

fun main() = runBlocking {
    println("start")

    var num = 0;

    val job = launch {
        println("coroutine1 start -->")
        while (num < 5) {
            delay(1000)
            num++
            println("num: $num")
        }
        println("coroutine1 --> end ")
    }

    launch {
        println("coroutine2 start -->")
        job.join()
        println("coroutine2 --> end ")
    }

    println("end")
}